using Pyxis.FluentSelenium.Tasks;

namespace Pyxis.FluentSelenium.SampleWebAppTest.Forum
{
    public class AddNewPostTask : ITask
    {
        private readonly string name;
        private readonly string subject;
        private readonly string message;

        public AddNewPostTask(string name, string subject, string message)
        {
            this.name = name;
            this.subject = subject;
            this.message = message;
        }

        public void Execute(User user)
        {
            user.For(PostListPage.AddPostButton).Clicks();

            user.For(NewPostPage.AuthorTextBox).Enters(name);
            user.For(NewPostPage.SubjectTextBox).Enters(subject);
            user.For(NewPostPage.MessagetTextBox).Enters(message);

            user.For(NewPostPage.SavePostButton).Clicks();
        }
    }
}